package com.menhai.personmanagement.controller;

import lombok.extern.slf4j.Slf4j;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.menhai.personmanagement.services.ISysRoleService;
import com.menhai.personmanagement.entity.SysRole;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author shikun
 * @since 2021-12-07
 */

@Slf4j
@RestController
@RequestMapping("/sys-role")
public class SysRoleController {

     @Autowired
     private ISysRoleService sysRoleService;

     @RequestMapping("/addRole")
     public int addRole(SysRole sysRole){
          return sysRoleService.addRole(sysRole);
     }

     @RequestMapping("/selectAll")
     public Page<SysRole> selectAll(@Param("pagesize") int pagesize,@Param("size") int size){
          return sysRoleService.selectAll(pagesize, size);
     }

     @RequestMapping("/editRole")
     public int editRole(SysRole sysRole){
          int temp = sysRoleService.editRole(sysRole);
          return temp;
     }

     @RequestMapping("/findRole")
     public List findRole(@Param("roleName") String roleName){
          return sysRoleService.findRole(roleName);
     }

     @RequestMapping("/delRole")
     public int delRole(@Param("id") int id){
          return sysRoleService.delRole(id);
     }
}
